//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.jasperframework.boot.common.modules.redis.config;

import cn.hutool.core.util.ObjectUtil;
import com.jasperframework.boot.common.utils.SpringContextUtil;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 消息的委托类
 */
@Component
@Slf4j
@NoArgsConstructor
@EqualsAndHashCode
public class DefaultMessageDelegate{

    public void handleMessage(Map message) {
        Object handlerName = message.get("handlerName");
        RedisMessageDelegate redisMessageDelegate = SpringContextUtil.getBean(handlerName.toString(), RedisMessageDelegate.class);
        if (ObjectUtil.isNotEmpty(redisMessageDelegate)) {
            redisMessageDelegate.handleMessage(message);
        }else {
            log.error("没有找到订阅者！");
        }
    }

}
